package com.example.store.common;

import com.example.store.entity.User;

import java.io.Serializable;

/**
 * 响应结果集
 * @param <E> 响应的数据类型
 */
public class JsonResult<E> implements Serializable {
    // 响应码
    private Integer state;
    //状态描述信息
    private String message;
    //数据
    private E data;
    public JsonResult(){
        super();
    }

    public JsonResult(Integer state, E data) {
        super();
        this.state = state;
        this.data = data;
    }
    public JsonResult(Integer state){
        super();
        this.state = state;
    }

    public JsonResult(Throwable e){
        super();
        this.message = e.getMessage();
    }

    /**
     * Getter Setter 方法
     */
    public Integer getState() {
        return state;
    }

    public void setState(Integer state) {
        this.state = state;
    }

    public String getMessage() {
        return message;
    }

    public void setMessage(String message) {
        this.message = message;
    }

    public E getData() {
        return data;
    }

    public void setData(E data) {
        this.data = data;
    }
}
